package com.tanhua.server.controller;


import com.tanhua.server.service.MessageService;
import com.tanhua.server.utils.NoAuthorization;
import com.tanhua.server.vo.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("messages")
public class MessageController {

    @Autowired
    private MessageService messageService;

    //点赞数
    @RequestMapping("likes")
    public PageResult queryLikesList(@RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pagesize",defaultValue = "10") Integer pageSize){
        return this.messageService.queryLikesList(page,pageSize);
    }

    //评论
    @RequestMapping("comments")
    public PageResult queryCommentList(@RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pagesize",defaultValue = "10") Integer pageSize){
        return this.messageService.queryCommentList(page,pageSize);
    }

    //喜欢数
    @RequestMapping("loves")
    public PageResult queryLoveList(@RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pagesize",defaultValue = "10") Integer pageSize){
        return this.messageService.queryLoveList(page,pageSize);
    }

    //公告
    @RequestMapping("announcements")
    @NoAuthorization   //优化,无需进行token校验
    public PageResult queryAnnouncementsList(@RequestParam(value = "page",defaultValue = "1") Integer page, @RequestParam(value = "pagesize",defaultValue = "10") Integer pageSize){
        return this.messageService.queryAnnouncementsList(page,pageSize);
    }

}
